package server.world.map

import server.world.character._

class Tile(val xCor:Int, val yCor:Int, val map:LocationMap){
  
  val texure:Texture = new Texture()
    
  var characterOnTile:GameCharacter = null
  
  def isAdjacent(loc:Tile) = if((loc.xCor-this.xCor).abs + (loc.yCor -this.yCor).abs<=2) true else false
  
  def distance(loc:Tile): Int = math.hypot(xCor - loc.xCor, yCor - loc.yCor).toInt
  
  def isEmpty() = if(characterOnTile != null ) false else true
  
  var node:Node = null;
  def makeNode() { node = new Node() } 
  
  class Node{
    var visited:Boolean = false
    var cost:Float = Float.MaxValue
  }
  
  class Texture {
  var attribute:String = "FLAT"
  def ispassable():Boolean = attribute == "FLAT"
  }
}

